package 笔试.贝壳;

import java.util.ArrayList;
import java.util.List;

public class Demo3 {
    public static void main(String[] args) {
        //Scanner sc = new Scanner(System.in);
        int[] a = {2,3,4};
        section(a,6);
    }

    public static long section (int[] a, int t) {
        // write code here
        long res = 0;
        int len = a.length;
        long count = (len-1)*len/2;
        List<int[]> list = new ArrayList<>();
        //判断存在两个数异或为t
        for(int i=0;i<a.length;i++){
            for (int j = i+1; j < a.length; j++) {
                if((a[i]^a[j])==t){
                    list.add(new int[]{i,j});
                }
            }
        }
        for(int[] nums:list){
            int f = nums[0];
            int s = nums[1];
           /* for (int d : nums) {
                System.out.println(d);
            }*/
            count -= len-s-f-1;

        }

        return count;


    }
}
